package com.gmlive.common.sample.widgets

import android.annotation.SuppressLint
import android.os.Bundle
import com.gmlive.common.sample.R
import com.gmlive.common.ui.app.IkCompatActivity
import com.gmlive.common.ui.app.annotation.Immerse
import com.gmlive.common.ui.systembartint.SystemBarUtil
import com.gmlive.common.widget.wheelpicker.adapter.PickerAdapter
import kotlinx.android.synthetic.main.activity_status_bar.*

@Immerse(translucentSystemBars = true, darkStatusBar = false, fitSystemWindows = true)
class StatusBarActivity : IkCompatActivity() {

    @SuppressLint("SetTextI18n")
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_status_bar)
        setupActionBar()

        picker_view.adapter = pickerAdapter

        navBarHeight.text = "NavigationBar Height = " + SystemBarUtil.getNavigationBarHeight(this)
    }

    private fun setupActionBar() {
        setSupportActionBar(toolbar)

        supportActionBar?.apply {
            setDisplayHomeAsUpEnabled(true)
        }
    }

    private val pickerAdapter = object: PickerAdapter<String> {
        val items = mutableListOf<String>("1", "2", "3", "4", "5", "6", "7", "8")
        override fun getItemsCount(): Int {
            return items.size
        }

        override fun getItem(index: Int): String {
            return items[index]
        }

        override fun indexOf(o: String?): Int {
            return items.indexOf(o)
        }

    }
}
